ASC Function ---------------------------------------------------------------------------- Action Returns a numeric value that is the ASCII code for the first character in a string expression. Syntax ASC( stringexpression$) Remarks If the argument stringexpression$ is null, Basic generates the run-time error message Illegal function call. See Also CHR$; Appendix A, "Keyboard Scan Codes and ASCII Character Codes" Example The following example uses ASC to calculate a hash value -- an index value for a table or file -- from a string. CONST HASHTABSIZE = 101 CLS ' Clear the screen. INPUT "Enter a name. ",Nm$ ' Prompt for input. TmpVal = 0 FOR I=1 TO LEN(Nm$) ' Convert the string to a number by summing the values ' of individual letters. TmpVal = TmpVal + ASC(MID$(Nm$,I,1)) NEXT I ' Divide the sum by the size of the table. HashValue = TmpVal MOD HASHTABSIZE PRINT "The hash value is "; HashValue Output Enter a name. Bafflegab The hash value is 66